import request from '@/utils/request'

// 获取药品列表
export function getMedicineList(params: {
  categoryId?: string
  keyword?: string
  status?: string
  page?: number
  limit?: number
}) {
  return request({
    url: '/api/medicines',
    method: 'GET',
    params
  })
}

// 获取药品详情
export function getMedicineDetail(id: string) {
  return request({
    url: `/api/medicines/${id}`,
    method: 'GET'
  })
}

// 创建药品
export function createMedicine(data: any) {
  return request({
    url: '/api/medicines',
    method: 'POST',
    data
  })
}

// 更新药品
export function updateMedicine(id: string, data: any) {
  return request({
    url: `/api/medicines/${id}`,
    method: 'PUT',
    data
  })
}

// 删除药品
export function deleteMedicine(id: string) {
  return request({
    url: `/api/medicines/${id}`,
    method: 'DELETE'
  })
}

// 获取分类列表
export function getCategoryList() {
  return request({
    url: '/api/medicines/categories/list',
    method: 'GET'
  })
}